
import 'package:flutter/material.dart';

class ContainerOrText extends StatelessWidget {
  const ContainerOrText({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('ContainerOrText'),
      ),
      body: Column(
        children: [
          ConDiv(),
          ConBotton(),
          ConText2(),
        ],
      ),
    );
  }
}

class ConDiv extends StatelessWidget {
  const ConDiv({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
        child: Container(
          // margin: const EdgeInsets.all(10),
          margin: const EdgeInsets.fromLTRB(0, 60, 0, 0),
          alignment: Alignment.center, // 子元素居中
          width: 100,
          height: 100,
          // transform: Matrix4.translationValues(100, 0, 0), // 位移
          transform: Matrix4.rotationZ(0.2), // x轴旋转
          // transform: Matrix4.skewY(20), // y轴倾斜
          // color: Colors.red,  // 背景颜色
          decoration: BoxDecoration(
            // color: Colors.red, // 背景颜色
            borderRadius: BorderRadius.circular(10),
            border: Border.all(color: Colors.black,width: 2,),
            boxShadow: const [
              BoxShadow(color: Colors.black,offset: Offset(0, 0),blurRadius: 10,spreadRadius: 0,)
            ],
            gradient: const LinearGradient( // 渐变背景
              colors: [Colors.yellow, Colors.blue],
              begin: Alignment.topLeft,
              end: Alignment.bottomRight,
            ),
          ),
          child: const Text('hello world'),
        )
      );
  }
}

class ConBotton extends StatelessWidget {
  const ConBotton({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      width: 200,
      height: 40,
      margin: const EdgeInsets.fromLTRB(0, 60, 0, 0),
      decoration: BoxDecoration(
        color: Colors.red,
        borderRadius: BorderRadius.circular(10),
      ),
      child: const Text('按钮',style: TextStyle(color: Colors.white,fontSize: 20,),),
    );
  }
}


class ConText2 extends StatelessWidget {
  const ConText2({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.topLeft,
      width: 200,
      height: 200,
      margin: const EdgeInsets.fromLTRB(0, 60, 0, 0),
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.circular(10),
      ),
      child: const Text(
        '你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界你好世界',
        textAlign: TextAlign.left,
        overflow: TextOverflow.ellipsis, // 溢出省略号
        maxLines: 2, // 最多显示2行
        style: TextStyle(
          fontSize: 20,
          color: Colors.white,
          fontWeight: FontWeight.bold,
          fontStyle: FontStyle.italic,
          letterSpacing: 2, // 字母间距
          wordSpacing: 2, // 单词间距
          height: 2, // 行高
          decoration: TextDecoration.underline, // 下划线
          decorationColor: Colors.white, // 下划线颜色
          decorationStyle: TextDecorationStyle.dotted, // 下划线样式 dotted虚线 underline下划线
          shadows: [ // 阴影
            Shadow(color: Colors.red,offset: Offset(0, 0),blurRadius: 10,),
          ],
          fontFeatures: [FontFeature.tabularFigures()], // 等宽字体
          fontVariations: [FontVariation('opsz', 30)], // 字体大小
        ),
      ),
    );
  }
}
